import Taro, { Component } from '@tarojs/taro'
import { View } from '@tarojs/components'
import classNames from 'classnames'
import PropsType from 'prop-types'
import { AtButton } from 'taro-ui'
import '../itemdetail.scss'

export default class DFooter extends Component {

    onFirstClick() {
        this.props.onFirstClick && this.props.onFirstClick()
    }

    onSeconClick() {
        this.props.onSeconClick && this.props.onSeconClick()
    }

    render() {
        const {
            className,
            firstClass,
            secondClass,
            firstText = '',
            secondText = ''
        } = this.props
        return (
            <View className={classNames('b_itemdetail__footer', className)}>
                {
                    firstText && <AtButton onClick={this.onFirstClick.bind(this)} className={classNames('item_btn item_btn__default', firstClass)}>{firstText}</AtButton>
                }
                {
                    secondText && <AtButton onClick={this.onSeconClick.bind(this)} className={classNames('item_btn', secondClass)}>{secondText}</AtButton>
                }
            </View>
        )
    }
}

DFooter.PropsType = {
    className: PropsType.oneOfType[PropsType.string, PropsType.object],
    firstClass: PropsType.oneOfType[PropsType.string, PropsType.object],
    secondClass: PropsType.oneOfType[PropsType.string, PropsType.object],
    firstText: PropsType.string,
    secondText: PropsType.string
}




